
/*================================================================================*/
/* FIGURES AND TABLES IN MAIN TEXT */
/* Date: 12 June 2023 */
/* Eventstudy3 is exactly the same as eventstudy2 but has removed all log files   */
/* automatically created by the eventstudy2 command */
/*================================================================================*/

ssc install eventstudy2

global raw "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/RAW/"
global result "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/RESULTS/"

cd "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/DATA/"

log using "/Users/myramohnen/Dropbox/EventStudy_Paris/JAERE/ConditionalAccept/RESULTS/3_results.log", replace

/*==============================================================================*/
/* Figure 1. S&P500Futures trading volumes */
/*==============================================================================*/

clear
import excel "${raw}SP_Futures_Emini.xlsm", sheet("Sheet2") cellrange(A4:HM5) firstrow allstring clear

rename (E-HM) var`i'#, addnumber(1)

foreach v of var (var1-var217) {
    local lbl : var label `v'
    local lbl = strtoname("`lbl'")
    rename `v' `v'`lbl'
}
destring (var1__5_1_2015-var217_2_29_2016), replace force

reshape long var`i', i(Name) j(fyr, string)

gen TradingDay = regexs(1) if regexm(fyr, "^([0-9]+)_")

destring TradingDay, replace

gen DateOld = regexs(2) if regexm(fyr, "^([0-9]+)[_]+([0-9]+[_][0-9]+[_][0-9]+)")

generate Date = date(Date, "MDY")
format %td Date

sort TradingDay
replace var = var/1000

twoway line var Date, lcolor(black) graphregion(color(white)) ///
ytitle("Volume traded (in thds)") xtitle("") ///
xlabel(20209 "1 May 2015" 20302 "1 Aug 2015" 20393 "1 Nov 2015" 20485 "1 Feb 2016") ///
text(5000 20302 "Flash Crash" 3990 20400 "Paris Agreement") ///
text(4750 20302 "24 Aug. 2015" 3700 20400 "14 Dec. 2015")

graph export "${result}Fig1.pdf", replace

/*==============================================================================*/
/* Figure 3. Abnormal returns for top 30% green firms (GR 97-100%) */
// rolling 3-day CAARs of the top 30% of green firms with 95% Corrado-Cowan confidence intervals 
// Monday Dec 14 is event day 0 
// Estimation window is the 100 days prior to the pre-negotiation period
/*==============================================================================*/

// Pre-negotiation period estimates

use "List_US_MinGR_top8Xtile.dta", clear

quietly eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
garch archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

// Negotiation period estimates

use "List_US_MinGR_top8Xtile.dta", clear

quietly eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 
 
// Post-negotiation period estimates

use "List_US_MinGR_top8Xtile.dta", clear

quietly eventstudy3 ISIN Date using Returns_US_MinGR_top8Xtile, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear // This is the data for the pre-negotiation period

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the negotiation period 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch) // This is the data for the post - negotiation period 

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 4 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig3.pdf", replace

/*==============================================================================*/
/* Figure 4. Abnormal returns for portfolios consisting of firms with different green revenue intensity */
// panel a. Event path for firms with only green revenue (GR=100%)
/*==============================================================================*/

use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_eq1) carfile(Car_Diag_Post_MinGR_eq1) ///
replace 

use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Negot_MinGR_eq1) carfile(Car_Diag_Negot_MinGR_eq1) ///
replace 

use "List_US_MinGR_eq1.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_eq1, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGR_eq1) carfile(Car_Diag_Pre_MinGR_eq1) ///
replace 

// Merge dataset 

use "Car_Diag_Pre_MinGR_eq1.dta", clear

drop if _n==10

mmerge t using "Car_Diag_Negot_MinGR_eq1", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_eq1", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -10 if CILB<-10
replace CILB90 = -10 if CILB90<-10
replace CIUB = 20 if CIUB > 20
replace CIUB90 = 20 if CIUB90>20

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig4a.pdf", replace

/*==============================================================================*/
/* Figure 4. Abnormal returns for portfolios consisting of firms with different green revenue intensity */
// panel b. top 40% green firms (GR 70-100%)
/*==============================================================================*/

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGRtop40pc) carfile(Car_Diag_Post_MinGRtop40pc) ///
replace 

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Negot_MinGRtop40pc) carfile(Car_Diag_Negot_MinGRtop40pc) ///
replace 

use "List_US_MinGR_top40pc.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top40pc, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) ///
car2LB(-13) car2UB(-11) ///
car3LB(-14) car3UB(-12) ///
car4LB(-15) car4UB(-13) ///
car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) ///
car7LB(-18) car7UB(-16) ///
car8LB(-19) car8UB(-17) ///
car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGRtop40pc) carfile(Car_Diag_Pre_MinGRtop40pc) ///
replace 

// merge data

use "Car_Diag_Pre_MinGRtop40pc.dta", clear
drop if _n== 10

mmerge t using "Car_Diag_Negot_MinGRtop40pc", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGRtop40pc", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -10 if CILB<-10
replace CILB90 = -10 if CILB90<-10
replace CIUB = 20 if CIUB > 20
replace CIUB90 = 20 if CIUB90>20

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig4b.pdf", replace

/*==============================================================================*/
/* Figure 4. Abnormal returns for portfolios consisting of firms with different green revenue intensity */
// panel c. median of green firms (GR 25-43%)
/*==============================================================================*/

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top5Xtile) crossfile(Cross_Post_MinGR_top5Xtile) carfile(Car_Diag_Post_MinGR_top5Xtile) ///
replace 

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top5Xtile) crossfile(Cross_Neg_MinGR_top5Xtile) carfile(Car_Diag_Neg_MinGR_top5Xtile) ///
replace

use "List_US_MinGR_top5Xtile.dta", clear

eventstudy3 ISIN Date using Returns_US_MinGR_top5Xtile, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) ///
car2LB(-13) car2UB(-11) ///
car3LB(-14) car3UB(-12) ///
car4LB(-15) car4UB(-13) ///
car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) ///
car7LB(-18) car7UB(-16) ///
car8LB(-19) car8UB(-17) ///
car9LB(-20) car9UB(-18)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_MinGR_top5Xtile) crossfile(Cross_Pre_MinGR_top5Xtile) carfile(Car_Diag_Pre_MinGR_top5Xtile) ///
replace 

// merge dataset

use "Car_Diag_Pre_MinGR_top5Xtile.dta", clear

drop if _n==10

mmerge t using "Car_Diag_Neg_MinGR_top5Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top5Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -10 if CILB<-10
replace CILB90 = -10 if CILB90<-10
replace CIUB = 20 if CIUB > 20
replace CIUB90 = 20 if CIUB90>20

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig4c.pdf", replace

/*==============================================================================*/
/* Figure 4. Abnormal returns for portfolios consisting of firms with different green revenue intensity */
// panel d. any green revenue between 2009-13 (GR>0)
/*==============================================================================*/

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-1) car1UB(1) car2LB(0) car2UB(2) car3LB(1) car3UB(3) car4LB(2) car4UB(4) car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) car7LB(5) car7UB(7) car8LB(6) car8UB(8) car9LB(7) car9UB(9) car10LB(8) car10UB(10) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1)  ///
diagnosticsfile(Diag_POST_MinGR_yes0913) carfile(Car_Diag_POST_MinGR_yes0913) ///
replace 

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-2) car1UB(0) car2LB(-3) car2UB(-1) car3LB(-4) car3UB(-2) car4LB(-5) car4UB(-3) car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) car7LB(-8) car7UB(-6) car8LB(-9) car8UB(-7) car9LB(-10) car9UB(-8) car10LB(-11) car10UB(-9)  ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_yes0913) carfile(Car_Diag_Neg_MinGR_yes0913) ///
replace 

use "List_EV2_US_MinGR_yes0913.dta", clear

eventstudy3 ISIN Date using Returns_EV2_US_MinGR_yes0913, returns(Return_Unadj) /// 
car1LB(-12) car1UB(-10) car2LB(-13) car2UB(-11) car3LB(-14) car3UB(-12) car4LB(-15) car4UB(-13) car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) car7LB(-18) car7UB(-16) car8LB(-19) car8UB(-17) car9LB(-20) car9UB(-18) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) mod(FM) logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_PRE_MinGR_yes0913) carfile(Car_Diag_PRE_MinGR_yes0913) ///
replace 

// merge

use "Car_Diag_PRE_MinGR_yes0913.dta", clear

drop if _n==10

mmerge t using "Car_Diag_Neg_MinGR_yes0913", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_POST_MinGR_yes0913", type(1:1) missing(nomatch)


gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

gen CILB90 = CAARE - 1.645*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB90 = CAARE + 1.645*(abs(CAARE/NCAARECorrado_Cowan))

sort tNum

replace CILB = -10 if CILB<-10
replace CILB90 = -10 if CILB90<-10
replace CIUB = 20 if CIUB > 20
replace CIUB90 = 20 if CIUB90>20

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig4d.pdf", replace

/*==============================================================================*/
/* Figure 5. Abnormal returns of top decile of green patenting firms */
// rolling 3-day CAARs for the top decile of firms with the highest clean patent intensity 
// 95% Corrado-Cowan confidence intervals 
/*==============================================================================*/

use "List_Patents_US_top10Ratio_grant_0013.dta", clear

eventstudy3 ISIN Date using Returns_Patents_US_top10Ratio_grant_0013, returns(Return_Unadj) /// 
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_Patentstop10Rat_grant) carfile(Car_Diag_Post_Patentstop10Rat_grant) ///
replace 

use "List_Patents_US_top10Ratio_grant_0013.dta", clear

eventstudy3 ISIN Date using Returns_Patents_US_top10Ratio_grant_0013, returns(Return_Unadj) /// 
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9)  ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_Patentstop10Rat_grant) carfile(Car_Diag_Neg_Patentstop10Rat_grant) ///
replace 

use "List_Patents_US_top10Ratio_grant_0013.dta", clear

eventstudy3 ISIN Date using Returns_Patents_US_top10Ratio_grant_0013, returns(Return_Unadj) /// 
mod(FM) ///
logreturns ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) eswlb(-121) eswub(-21) ///
car1LB(-12) car1UB(-10) ///
car2LB(-13) car2UB(-11) ///
car3LB(-14) car3UB(-12) ///
car4LB(-15) car4UB(-13) ///
car5LB(-16) car5UB(-14) ///
car6LB(-17) car6UB(-15) ///
car7LB(-18) car7UB(-16) ///
car8LB(-19) car8UB(-17) ///
car9LB(-20) car9UB(-18)  ///
garch archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Pre_Patentstop10Rat_grant) carfile(Car_Diag_Pre_Patentstop10Rat_grant) ///
replace 

// All datasets

use "Car_Diag_Pre_Patentstop10Rat_grant.dta", clear

drop if _n==10

mmerge t using "Car_Diag_Neg_Patentstop10Rat_grant", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_Patentstop10Rat_grant", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB=-15 if CILB<-15
replace CIUB=20 if CIUB>20

sort tNum

twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-15(5)20)) ylabel(-15(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig5.pdf", replace

/*==============================================================================*/
/* Figure 6a. Sautner data
Firms with high climate related opportunity based on median */
/*==============================================================================*/

use "List_high_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_op_expo_ew, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_high_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_op_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 
 

use "List_high_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_high_op_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig6a.pdf", replace

/*==============================================================================*/
/* Figure 6b. Sautner data
Firms with low climate related opportunity based on median */
/*==============================================================================*/

use "List_low_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_op_expo_ew, returns(Return_Unadj) /// 
mod(FM) /// Fama French model 
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) /// factors
riskfreerate(RFNum) /// risk free 
evwlb(-20) /// event window lower bound
evwub(10) /// event window upper bound 
eswlb(-121) /// estimation window lower bound 
eswub(-21) /// estimation window upper bound 
logreturns /// log returns
car1LB(-12) car1UB(-10) /// CAR window 1 bounds
car2LB(-13) car2UB(-11) /// CAR window 2 bounds
car3LB(-14) car3UB(-12) /// CAR window 3 bounds
car4LB(-15) car4UB(-13) /// CAR window 4 bounds
car5LB(-16) car5UB(-14) /// CAR window 5 bounds
car6LB(-17) car6UB(-15) /// CAR window 6 bounds
car7LB(-18) car7UB(-16) /// CAR window 7 bounds
car8LB(-19) car8UB(-17) /// CAR window 8 bounds
car9LB(-20) car9UB(-18) /// CAR window 9 bounds
archoption(1) garchoption(1) /// ARCH option GARCH option
diagnosticsfile(Diag_Pre_MinGR_top8Xtile) /// output diagnostic 
carfile(Car_Diag_Pre_MinGR_top8Xtile) /// output cumulative average abnormal return file
aarfile(AAR) ///
replace 

use "List_low_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_op_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20) evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-2) car1UB(0) ///
car2LB(-3) car2UB(-1) ///
car3LB(-4) car3UB(-2) ///
car4LB(-5) car4UB(-3) ///
car5LB(-6) car5UB(-4) ///
car6LB(-7) car6UB(-5) ///
car7LB(-8) car7UB(-6) ///
car8LB(-9) car8UB(-7) ///
car9LB(-10) car9UB(-8) ///
car10LB(-11) car10UB(-9) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Neg_MinGR_top8Xtile) ///
carfile(Car_Diag_Neg_MinGR_top8Xtile) ///
aarfile(AAR_neg) ///
replace 


use "List_low_op_expo_ew", clear

eventstudy3 ISIN Date using Returns_low_op_expo_ew, returns(Return_Unadj) /// 
mod(FM) ///
marketfile(Market_US_MinGR_top8Xtile) mar(MktNum) idmarket(Market_ID) /// 
factor1(SMBNum) factor2(HMLNum) riskfreerate(RFNum) ///
evwlb(-20)  evwub(10) ///
eswlb(-121) eswub(-21) ///
logreturns ///
car1LB(-1) car1UB(1) ///
car2LB(0) car2UB(2) ///
car3LB(1) car3UB(3) ///
car4LB(2) car4UB(4) ///
car5LB(3) car5UB(5) ///
car6LB(4) car6UB(6) ///
car7LB(5) car7UB(7) ///
car8LB(6) car8UB(8) ///
car9LB(7) car9UB(9) ///
car10LB(8) car10UB(10) ///
archoption(1) garchoption(1) /// 
diagnosticsfile(Diag_Post_MinGR_top8Xtile) ///
carfile(Car_Diag_Post_MinGR_top8Xtile) ///
aarfile(AAR_post) ///
replace 

// Gather info for CAAR 
 
use "Car_Diag_Pre_MinGR_top8Xtile.dta", clear 

drop if _n==10
mmerge t using "Car_Diag_Neg_MinGR_top8Xtile", type(1:1) missing(nomatch) 
mmerge t using "Car_Diag_Post_MinGR_top8Xtile", type(1:1) missing(nomatch)

gen tNum = ""
replace tNum = usubstr(t, 1, ustrpos(t, ";") - 1)
replace tNum = subinstr(tNum, "[", "",.) 
destring tNum, replace
replace tNum = tNum+1

order tNum, after(t)

replace CAARE = CAARE * 100

// Corrado-Cowan CIs
gen CILB = CAARE - 1.96*(abs(CAARE/NCAARECorrado_Cowan))
gen CIUB = CAARE + 1.96*(abs(CAARE/NCAARECorrado_Cowan))

replace CILB = -10 if CILB<-10
replace CIUB = 20 if CIUB>20

sort tNum
twoway line CAARE tNum, lcolor(red) lwidth(medthick) ///
yscale(range(-10(5)20)) ylabel(-10(5)20) ///
xlabel(-20(2)10) ///
graphregion(color(white)) ///
xtitle("Trading day to/from Monday 14/12/2015") ytitle("CAAR (in %)") ///
legend(off) ///
xline(-10, lcolor(black)) xline(0, lcolor(black)) ///
yline(0, lcolor(black)) ///
text(18 -15 "Pre-negotiation") ///
text(18 -6 "Negotiation") ///
text(18 5 "Post-negotiation") ///
|| rcap CILB CIUB tNum, lcolor(blue) 

graph export "${result}Fig6b.pdf", replace


log close




